/*
 * TagFloat.cpp
 *
 *  Created on: 19 juin 2011
 *      Author: Pierrick Caillon <pierrick@megami.fr>
 */

#include "TagFloat.h"

/* NAMEDTAG_H_ */
/* NUMERICVALUE_H_ */
namespace NamedBinaryTag
{
    TagFloat::TagFloat()
    :NamedTag(), value(*(float*)(("\x00\x00\x80\xFF")))
    {
    }

    TagFloat::~TagFloat()
    {
    }

    void TagFloat::set_Value(float value)
    {
        this->value = value;
    }

    float TagFloat::get_Value() const
    {
        return this->value;
    }

    TagTypes TagFloat::get_TagType() const
    {
        return TAG_FLOAT;
    }

    void TagFloat::Read(std::istream & input, bool ignoreName)
    {
        NamedTag::Read(input, ignoreName);
        ReadData(input, (char*)((&this->value)));
    }

    void TagFloat::Write(std::ostream & output, bool ignoreName) const
    {
        NamedTag::Write(output, ignoreName);
        WriteData(output, (const char*)((&this->value)));
    }

    ITag *TagFloat::clone() const
    {
    	return this->clone(NULL);
    }

    ITag *TagFloat::clone(void *newRoot) const
    {
        TagFloat *copy = new TagFloat(newRoot);
        copy->value = this->value;
        return copy;
    }

}
